	//부킹탭
	function clsMyBookingInfoDonation_Tab(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsMyBookingInfoDonation_Tab.prototype = {
		_init: function(){
			var $layer = $("section#my_booking_info_donation section div.tab_menu ul li");			      
			this._HTMLDom = {
				"$layer": $layer	
			}
			$layer.removeClass("on1 on2 on3").eq(0).addClass("on1");			
			$layer.eq(1).hide();
		}	
		, $getBtnTab: function(){
			return this._HTMLDom["$layer"];	
		}
	}
	
	//부킹요약
	function clsMyBookingInfoDonation_Info(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();	
	}
	
	clsMyBookingInfoDonation_Info.prototype = {
		_init: function(){
			var $layer = $("section#my_booking_info_donation section div.bo_table table tbody tr");
			this._HTMLDom = {
				"$layer": $layer	
			}
			$layer.find("td").html(0);
			
			//웨이팅예약 숨김
			$layer.parent().prev().find("tr th:eq(2)").hide();			
			$layer.find("td").eq(2).hide();
		}
		, setReserveConfirm: function(val){
			//예약완료			
			this._HTMLDom["$layer"].find("td:eq(0)").html(val)
		}
		, setPaymentWait: function(val){
			//보증결제대기
			this._HTMLDom["$layer"].find("td:eq(1)").html(val)
		}
		, setWaiting: function(val){
			//웨이팅예약
			this._HTMLDom["$layer"].find("td:eq(2)").html(val)
		}
		, setDonation: function(val){
			//자선예약
			this._HTMLDom["$layer"].find("td:eq(3)").html(val)
		}
	}
	
	//부킹목록
	function clsMyBookingInfoDonation_List(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsMyBookingInfoDonation_List.prototype = {
		_init: function(){
			var $layer = $("section#my_booking_info_donation section article.donation_list");
			
			this._HTMLDom = {
				"$layer": $layer	
				, "$element": $layer.find(">dl:first")
			}
			$layer.empty();
		}
		, setList: function(thisData){
			if(!this.listData) this.listData = [];
			this.push(thisData);
		}
		, push: function(thisData){
			var thisClass = this;
			var $element = this._HTMLDom["$element"];
			var $tmp = [];
		
			for(var i=0;i<thisData.length;++i){
				/*
				"예약코드": _util.nvl(obj["reserveSeq"])
				, "시작일": _util.nvl(obj["startDt"])
				, "종료일": _util.nvl(obj["endDt"])
				, "라운드날짜": _util.nvl(obj["reservDate"])
				, "시간대": _util.nvl(obj["bookingTime"])
				, "지역코드": _util.nvl(obj["region"])
				, "골프장명": _util.nvl(obj["golfClubNm"])
				, "코스명": _util.nvl(obj["courseInfoNm"])
				, "그린피": _util.nvl(obj["greenFee"], 0)
				, "상태코드": _util.nvl(obj["reservStatus"]) // C:진행중, E: 신청마감, F: 종료
				, "나의참여상태": _util.nvl(obj["joinStatus"])
				, "당첨코드": _util.nvl(obj["winnerYn"])
				
				<dt>
                  <p><em>신청기간  :</em>12.05.30~12.06.15</p>
                  <p><em>당첨자발표  :</em>12.07.01</p>
              </dt>
              <dd class="ui-grid-a">                          
                  <div class="ui-block-a">
                      <h5>Sky72 하늘코스</h5>                        
                      <ul>                    
                          <li><em>라운드날짜</em>2012.06.30(토)</li>
                          <li><em>티타임</em>06:30</li>
                          <li><em>1인 그린피</em><mark>￦2,500,000</mark></li>
                      </ul>
                  </div><!-- // class="ui-block-a"  -->  
                  
                  <div class="ui-block-b">
                      <!-- 내가 참여한 자선예약 일때 보이는 btn => 진행중 / 참여완료 --> 
                      <p class="ing">[  진행중  ]</p>
                      <p class="bt"><a href="../booking/donation_view.html" data-role="button" data-theme="a" data-inline="true"  data-transition="slide">참여완료</a></p>
                      
                      <!--  내가 참여한 자선예약 일때 보이는 btn => 신청마감/ 당첨자확인 --> 
                      <!--p class="final">[  신청마감  ]</p>
                      <p class="bt"><a href="../booking/donation_view.html" data-role="button" data-theme="d" data-inline="true"  data-transition="slide">당첨자확인</a></p-->
                      
                      <!--  내가 참여한 자선예약 일때 보이는 btn => 당첨/당첨포기 --> 
                      <!--p class="win">[  당첨  ]</p>
                      <p class="bt"><a href="../booking/donation_aband_popup.html" data-role="button" data-theme="c" data-inline="true" data-rel="dialog"  data-transition="slide">당첨포기</a></p-->
                      
                      <!--  내가 참여한 자선예약 일때 보이는 btn => 당첨포기/ 당첨자확인 --> 
                      <!--p class="aband">[  당첨포기  ]</p>
                      <p class="bt"><a href="../booking/donation_view.html" data-role="button" data-theme="d" data-inline="true"  data-transition="slide">당첨자확인</a></p-->
                      
                      <!--  내가 참여한 자선예약 일때 보이는 btn => 종료 --> 
                      <!--p class="end">[  종료  ]</p-->
                  </div><!-- // class="ui-block-b"  -->  
              </dd>
                
				*/
				$tmp.push($element.clone(true));
				$tmp[i].find("h5").html(thisData[i]["골프장명"] +"&nbsp;-&nbsp;"+ thisData[i]["코스명"]);
				$tmp[i].find("dt p:eq(0)").html("<em>신청기간  :</em>"+ thisData[i]["시작일"] +"~"+ thisData[i]["종료일"]);
				$tmp[i].find("dt p:eq(1)").html("<em>당첨자발표  :</em>"+ "당첨발표일없음");
				$tmp[i].find("dd div:eq(0)>ul li:eq(0)").html("<em>라운드날짜</em>"+ thisData[i]["라운드날짜"]);
				$tmp[i].find("dd div:eq(0)>ul li:eq(1)").html("<em>티타임</em>"+ thisData[i]["시간대"]);
				$tmp[i].find("dd div:eq(0)>ul li:eq(2) mark").html("￦"+ _util.fNum(thisData[i]["그린피"]));
				
				$tmp[i].find("dd div:eq(1) p:eq(0)").attr("class","");
				
				if(thisData[i]["상태코드"] == "E" || thisData[i]["상태코드"] == "F") {
					$tmp[i].find("dd div:eq(1) p:eq(0)").addClass("end").html("[  당첨포기  ]");
					$tmp[i].find("dd div:eq(1) p:eq(1)").hide();
				}else {
					$tmp[i].find("dd div:eq(1) p:eq(0)").addClass("ing").html("[  진행중  ]");
					$tmp[i].find("dd div:eq(1) p:eq(1)").show().filter("a").html("참여완료");
				}
				$tmp[i].css("cursor", "pointer");
				
				this.listData.push(thisData[i]);
			}
			this.display($tmp);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
					
			for(var i=0;i<thisData.length;++i){
				$layer.append(thisData[i]);	
			}
		}
		, reset: function(){			
			this.listData = [];			
			this._HTMLDom["$layer"].empty();
		}
		, $getBtnMore: function(){			            
			return $("section#my_booking_info_donation>section div.btn_area div.btn_more");
		}
		, $getLayer: function(){			
			return this._HTMLDom["$layer"];	
		}
		, getListCount: function(){
			if(!this.listData) return 0;
			return this.listData.length;
		}
	}
	
	//데이터연동		
	function clsComm_MyBookingInfoDonation(){
		this.reserveList = null;
		this.reserveListRequest = null;
		this.reserveListPageData = null;
		this._init();
	}	
	clsComm_MyBookingInfoDonation.prototype = {
		_init: function(){
			this.reserveListRequest = {
				"페이지": null	
			}
			this.reserveListPageData = {
				"현재페이지": null
				, "전체수": null
				//, "페이지당수": 10
				//, "블럭당페이지": 1
			}
		}
//------------------------ 예약현황------------------------//
		, getReserveList: function(arg){
			var thisClass = this;
			var szPage = this.reserveListRequest["페이지"];
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "DonationMyMainReservList");
        	objJson.putParameter("listcount", 10);
			objJson.putParameter("currpageno", szPage);
			
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		thisClass.reserveList = [];
        		
        		var items = ret["msp"]["contents"]["items"];
				if(items){
					thisClass.reserveListPageData["전체수"] = ret["msp"]["contents"]["@totalcount"];
					
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
												
						thisClass.reserveList.push({
							"예약코드": _util.nvl(obj["reserveSeq"])
							, "시작일": _util.nvl(obj["startDt"])
							, "종료일": _util.nvl(obj["endDt"])
							, "라운드날짜": _util.nvl(obj["reservDate"])
							, "시간대": _util.nvl(obj["bookingTime"])
							, "지역코드": _util.nvl(obj["region"])
							, "골프장명": _util.nvl(obj["golfClubNm"])
							, "코스명": _util.nvl(obj["courseInfoNm"])
							, "그린피": _util.nvl(obj["greenFee"], 0)
							, "상태코드": _util.nvl(obj["reservStatus"]) // C:진행중, E: 신청마감, F: 종료
							, "나의참여상태": _util.nvl(obj["joinStatus"])
							, "당첨코드": _util.nvl(obj["winnerYn"])
						});
					}
				}
				
				$(thisClass).trigger("evtFinishReserveList");
				
			}, function($err) {
				alert($err);
			});
		}
		, getReserveListData: function(){
			return this.reserveList;
		}
		, getReserveListPageData: function(){
			return this.reserveListPageData;
		}
		, setReserveListRequest: function(key, val){
			this.reserveListRequest[key] = val;
		}
		, getReserveListRequest: function(key){
			return this.reserveListRequest[key];
		}
//------------------------ 예약현황------------------------//				
//------------------------ 예약확정------------------------//		 
		, getBookingReserveConfirm: function(){
			var thisClass = this;
						
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyBookingAcnt");        	
        	
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		
				thisClass.bookingReserveConfirm = ret["msp"]["contents"]["items"];
				
				$(thisClass).trigger("evtFinishBookingReserveConfirm");
				
			}, function($err) {
				alert($err);
			});			
		}
		, getBookingReserveConfirmData: function(){
			return this.bookingReserveConfirm;
		}
//------------------------ 예약확정------------------------//
//------------------------ 보증결제대기------------------------//		
		, getBookingPaymentWait: function(){
			var thisClass = this;
						
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyBookingGcnt"); 
        
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		
				thisClass.bookingPaymentWait = ret["msp"]["contents"]["items"];	
				
				$(thisClass).trigger("evtFinishtBookingPaymentWait");
				
			}, function($err) {
				alert($err);
			});
		}
		, getBookingPaymentWaitData: function(){
			return this.bookingPaymentWait;
		}
//------------------------ 보증결제대기------------------------//		
//------------------------ 웨이팅------------------------//		
		, getBookingWaiting: function(){
			var thisClass = this;
						
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyWaitingCnt");        	
        	
        	cm.requestGet(objJson.getJsonString(), function(ret){
        	
				thisClass.bookingWait = ret["msp"]["contents"]["items"];			
				
				$(thisClass).trigger("evtFinishtBookingWait");
				
			}, function($err) {
				alert($err);
			});			
		}
		, getBookingWaitingData: function(){
			return this.bookingWait;	
		}
//------------------------ 웨이팅------------------------//		
	}
	
	//컨트롤파일
	function MyBookingInfoDonation(){		
		this.objComm = null;			
		this.objMyBookingInfoDonation_Tab = null;
		this.objMyBookingInfoDonation_Info = null;
		this.objMyBookingInfoDonation_List = null;
	};
	
	MyBookingInfoDonation.prototype = {
	    onPageShow : function() {
	    	/*사용자 로그인체크
	    	if(!common.userCheck()){
	    		alert("로그인 후 사용하시기 바랍니다.");
	    		return;
	    	}
	    	*/	      
	    	$("a").attr("href", "").attr("data-rel", "");	    	
	    	this._init();
	    }
	    , _init: function(){	    	
	    	
			this.objComm = new clsComm_MyBookingInfoDonation();
	      	this.objMyBookingInfoDonation_Tab = new clsMyBookingInfoDonation_Tab();
			this.objMyBookingInfoDonation_Info = new clsMyBookingInfoDonation_Info();
			this.objMyBookingInfoDonation_List = new clsMyBookingInfoDonation_List();
	      	this.getParam();
	     
	     	this._role();
	     	
	      	this._bind();
	      	this._eventFinish();     	
	    }
	    , _start: function(){	      	
	      	//예약현황 조회
	      	this.objComm.setReserveListRequest("페이지", 1);
	      	this.objComm.getReserveList();
	      	this.spinStart();
	      	
	      	//예약완료 조회
	      	this.objComm.getBookingReserveConfirm();
	      	//보증결제대기 조회
	      	this.objComm.getBookingPaymentWait();
	      	//웨이팅 조회
	      	this.objComm.getBookingWaiting();
	    }
	    , _eventFinish: function(){
	    	var thisClass = this;
	    	
	    	//예약현황 조회 완료 이벤트
		 	$(this.objComm).bind("evtFinishReserveList", function(event){
		 		var thisData = thisClass.objComm.getReserveListData();	
		 		var totalCnt = thisClass.objComm.getReserveListPageData();
		 			 	
		 		thisClass.objMyBookingInfoDonation_List.setList(thisData);
		 		thisClass.spinEnd();
		 		
		 		//더보기 버튼 
		 		if(thisClass.objMyBookingInfoDonation_List.getListCount() >= totalCnt["전체수"]) {
		 			thisClass.objMyBookingInfoDonation_List.$getBtnMore().hide();
		 		}else {
		 			thisClass.objMyBookingInfoDonation_List.$getBtnMore().show();
		 		}
		 	});
		 	
		 	//예약완료 조회 이벤트
		 	$(this.objComm).bind("evtFinishBookingReserveConfirm", function(event){
		 		var thisData = thisClass.objComm.getBookingReserveConfirmData();		 		
		 		thisClass.objMyBookingInfoDonation_Info.setReserveConfirm(thisData);
		 	});
		 	
		 	//보증결제대기 조회 이벤트
		 	$(this.objComm).bind("evtFinishtBookingPaymentWait", function(event){
		 		var thisData = thisClass.objComm.getBookingPaymentWaitData();
		 		thisClass.objMyBookingInfoDonation_Info.setPaymentWait(thisData);
		 	});
		 	
		 	//웨이팅 조회 이벤트
		 	$(this.objComm).bind("evtFinishtBookingWait", function(event){
		 		var thisData = thisClass.objComm.getBookingWaitingData();
		 		thisClass.objMyBookingInfoDonation_Info.setWaiting(thisData);
		 	});
	    }
		 , _bind: function(){
		 	var thisClass = this;
		 	
		 	//탭클릭
		 	this.objMyBookingInfoDonation_Tab.$getBtnTab().click(function(event){
		 		event.preventDefault();
		 		var n = thisClass.objMyBookingInfoDonation_Tab.$getBtnTab().index($(this));
		 		var _url = "";
		 		switch(n){
		 			case 0 : _url = "booking_info.html"; break;
		 			case 1 : _url = "booking_info_wait.html"; break;
		 			case 2 : _url = "booking_info_donation.html"; break;
		 		}
		 		$.mobile.changePage(_url,"slide",true);	
		 	});
		 	
		 	//상세보기
		 	this.objMyBookingInfoDonation_List.$getLayer().on("click","a",function(event){
		 		event.preventDefault();
		 		var n = thisClass.objMyBookingInfoDonation_List.$getLayer().find("a").index($(this));		 		
		 		
		 		_gf.BOOKING_DATA["bookingview"]["reserv_id"] = thisClass.objMyBookingInfoDonation_List.listData[n]["예약코드"];		 		
            				 		
		 		$.mobile.changePage("../booking/booking_view.html","slide",true);
		 	});
		 	
		 	//더보기
		 	this.objMyBookingInfoDonation_List.$getBtnMore().click(function(event){
		 		var page = thisClass.objComm.getReserveListRequest("페이지");
		 		thisClass.objComm.setReserveListRequest("페이지",(page+1));
		 		thisClass.objComm.getReserveList();
		 		thisClass.spinStart();
		 	});
		 	
		 	//메뉴
		 	$("section#my_booking_info_donation nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#my_booking_info_donation nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		 } 
		 , getParam: function(){
	    	
	    }
	    , _role: function(){
	    		if(!_util.getLogin("로그인")){
	    			//alert("로그인 후 이용하실 수 있습니다.");		    			
	    			this.goNavi();		
	    			return;    	
	    		}
	    		
    			this._start();	    		
	   }
		, goNavi: function(){
    		$.mobile.changePage("../inc/navi.html","slide",true);
		}
	    , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
	 		$.mobile.hidePageLoadingMsg();				
		}
	}
	